{% extends "base.html" %}
{% load cache %}

{% block title %}
  {{ object.title }}
{% endblock %}

{% block content %}
  <h1>
    {{ module.title }}
  </h1>
  <div class="contents">
    <h3>Modules</h3>
    <ul id="modules">
      {% for m in object.modules.all %}
        <li data-id="{{ m.id }}" {% if m == module %}class="selected"{% endif %}>
          <a href="{% url "student_course_detail_module" object.id m.id %}">
            <span>
              Module <span class="order">{{ m.order|add:1 }}</span>
            </span>
            <br>
            {{ m.title }}
          </a>
        </li>
      {% empty %}
        <li>No modules yet.</li>
      {% endfor %}
    </ul>
  </div>
  <div class="module">
    {% cache 600 module_contents module %}
      {% for content in module.contents.all %}
        {% with item=content.item %}
          <h2>{{ item.title }}</h2>
          {{ item.render }}
        {% endwith %}
      {% endfor %}
    {% endcache %}
  </div>
{% endblock %}
